package com.wn32.main;

import java.util.ArrayList;

public class StrCount {
    public static void main(String[] args) {
        ArrayList<Character> list = new ArrayList<Character>();
        String str="sfad,9ggsdgsddl5s";
       for(int i=0;i<str.length();i++){
           char c = str.charAt(i);
           list.add(c);
       }
       int count=0;
       char c=list.get(0);
        for (Character ch : list) {
            int tem=0;
            for (Character character : list) {
                if(ch.equals(character)){
                    tem++;
                }
            }
            if(tem>count){
                count=tem;
                c=ch;
            }
        }
        System.out.println("出现最多的字符:" + c);
        System.out.println("出现:" + count);

    }
}
